Skip to content

ptp: initial support for IEEE 1588/802.1AS PTP/gPTP#1472

Open
troglobit wants to merge 11 commits intomainfrom
gptp
Open

ptp: initial support for IEEE 1588/802.1AS PTP/gPTP#1472
troglobit wants to merge 11 commits intomainfrom
gptp

Conversation

@troglobit
Copy link
Copy Markdown
Contributor

@troglobit troglobit commented Apr 14, 2026

Summary

  • Full IEEE 1588-2019 / 802.1AS PTP support using the ieee1588-ptp-tt.yang and ieee802-dot1as-gptp.yang models, with augments in infix-ptp.yang, mainly for profile selection
  • Supports Ordinary Clock, Boundary Clock, and E2E/P2P Transparent Clock instance types
  • Hardware timestamping auto-detected; software fallback on mixed ports
  • Multi-chip DSA boards handled via boundary_clock_jbod and a silent phc2sys -a companion service that keeps all PHCs aligned on BC/TC instances
  • show ptp CLI command with port states, offset, and grandmaster identity
  • Inclusive IEEE 1588g-2022 terminology throughout (time transmitter, time receiver, BTCA)

Tests

Ten test cases under test/case/ptp/, each running both IEEE 1588 and IEEE 802.1AS profiles where applicable:

  • basic — smoke test: OC back-to-back
  • bmca — BTCA election and runtime re-election via priority1
  • boundary_clock — two-port BC, verifies steps-removed=2
  • transparent_clock — E2E-TC, P2P-TC, and 802.1AS TC
  • port_recovery — link-down/link-up fault recovery

Remaining work

Mostly covered by #1474, these are just a few relevant examples:

  • Modeling of phc2sys system-clock sync (PHC → CLOCK_REALTIME), ts2phc (GPS/PPS → PHC → ptp4l GM), and timemaster coordination — see TODO.org for the staged roadmap
  • CLI show ptp network command
  • CMLDS (requires upstream linuxptp + 802.1ASdm foundation)
  • Full 12-bit sdoId, fault log, performance monitoring

Checklist

Tick relevant boxes, this PR is-a or has-a:

  • Bugfix
    • Regression tests
    • ChangeLog updates (for next release)
  • Feature
    • YANG model change => revision updated?
    • Regression tests added?
    • ChangeLog updates (for next release)
    • Documentation added?
  • Test changes
    • Checked in changed Readme.adoc (make test-spec)
    • Added new test to group Readme.adoc and yaml file
  • Code style update (formatting, renaming)
  • Refactoring (please detail in commit messages)
  • Build related changes
  • Documentation content changes
    • ChangeLog updated (for major changes)
  • Other (please describe):

@troglobit troglobit force-pushed the gptp branch 9 times, most recently from 37dd1e9 to 13ce021 Compare April 18, 2026 05:48
@troglobit troglobit marked this pull request as ready for review April 18, 2026 07:14
@troglobit troglobit requested a review from wkz April 18, 2026 07:22
@troglobit troglobit self-assigned this Apr 18, 2026
@mattiaswal mattiaswal added the ci:main Build default defconfig, not minimal label Apr 18, 2026
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Fixes #1437

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
- Add a board README to explain how to get Infix running
- Update mkimage.sh to allow creating images without boot loader

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Inverted values for eMMC and SPI NAND.  Also use ABCD instead of
Position as column name to match board markings.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
NOTE: this is intended only for use on devboards like EspressoBin where
      the onboard bootloader only understands fat and ext2 file systems.
      To enable, use 'make apply-ext4'

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This is used by the next commit that adds initial support for PTP/gPTP.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Remaining work:
- phc2sys YANG model (infix-phc2sys.yang, instance-index + servo params)
- ts2phc YANG model (GPS/PPS → PHC → ptp4l GM path)
- timemaster coordination (Phase 3, after phc2sys YANG is stable)
- show ptp network (YANG action or background-polled topology container)
- CMLDS (requires upstream linuxptp + 802.1ASdm foundation)
- Full 12-bit sdoId, fault log, performance monitoring

Backported patches from linuxptp master:
- port: fix unicast negotiation recovery after FAULT_DETECTED
- udp: fix port-specific ptp/p2p_dst_ipv4 configuration
- pmc: avoid race conditions in agent update
- phc2sys: wait until pmc agent is subscribed (startup race)
- fix MAC driver incorrect SIOCGHWTSTAMP adjustment flags
- pmc_agent: longer update interval when not subscribed
- phc2sys: don't disable pmc agent with -s/-d/-w options
- port_signaling: respect ptp_minor_version in message header
- port: refresh link status on faults
- uds: copy server socket ownership in pmc clients (non-root pmc)
- uds: don't call chmod() on client socket
- port: allow mixing wildcard and exact clock identities
- Add pidfile support to ptp4l, phc2sys, and timemaster

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
On multi-chip DSA hardware (e.g., boards with multiple mv88e6xxx
chips), each switch chip has its own independent PHC device.  With
boundary_clock_jbod enabled, ptp4l starts but only disciplines the
active slave port's PHC — the others drift.

Automatically start phc2sys -a alongside any BC or TC instance using
hardware timestamping.  It subscribes to ptp4l's UDS socket, tracks
BMCA, and disciplines all non-active PHCs to match the active one.
On single-chip hardware it is a harmless no-op.

CLOCK_REALTIME is intentionally left untouched.  Syncing the system
clock to PTP (phc2sys -rr), feeding the PHC from GPS/NTP (ts2phc,
phc2sys reverse), and full multi-source coordination (timemaster) are
planned as follow-on phases; see the issue tracker for the roadmap.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:main Build default defconfig, not minimal

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants